#include <iostream>
#include<vector>
#include<set>
#include<algorithm>
#include<stdio.h>
#include<unordered_set>
using namespace std;
//疯狂在静态区开数组
const int Max = 8000;
bool mat[Max][Max];
bool vis[Max];
double water[Max];
void share(double water[Max], vector<int>& v)
{
	double re = 0;
	for (int j : v)
	{
		re += water[j];
	}
	re /= (double)v.size();
	for (int j : v)
	{
		water[j]=re;
	}
}
void dfs(bool mat[Max][Max], bool vis[Max],int i,int&n, vector<int>& v)
{
	if (vis[i] == 0)
	{
		vis[i] = 1;
		v.push_back(i);
		for (int j = 0; j < n; j++)
		{
			if (mat[i][j] == 1) { dfs(mat, vis, j, n, v);}
		}
	}
	else
	{
		return;
	}
}

int main()
{
	int n,pip;
	//cin >> n>>pip;
	scanf("%d%d", &n, &pip);

	
	//编号从1开始
	//bool** mat = new bool* [Max];
	//for (int i = 0; i < Max; i++)
	//{
	//	mat[i] = new bool[n];
	//}

	for (int i = 0; i < n; i++)
	{
		for (int j = 0; j < n; j++)
		{
			mat[i][j]=0;
		}
	}
	//double* water = new double[n];
	for (int i = 0; i < n; i++)
	{
		//scanf("%f", &water[i]);
		cin >> water[i];
	}
	int x, y;
	for (int i = 0; i < pip; i++)
	{
		scanf("%d%d", &x,&y);

		//cin >> x>>y;
		mat[x - 1][y - 1] = 1;
		mat[y - 1][x - 1] = 1;
	}
	//
	//int* vis = new int[n];
	for (int i = 0; i < n; i++)
	{
		vis[i] = 0;
	}
	//
	vector<int>v;
	for (int i = 0; i < n; i++)
	{
		if (vis[i] != 0) { continue; }
		{
			dfs(mat, vis, i, n, v);
		}
		//for (int j : v) { cout << j; }
		share(water, v);
		v.clear();
		//cout << "\n";
	}
	for (int i = 0; i < n; i++)
	{
		printf("%.2f", water[i]);
		cout <<  " ";
	}
}